//
//  KCompany_DocumentTableViewCell.m
//  fxxiaoke
//
//  Created by 鞠超 on 2016/10/22.
//  Copyright © 2016年 jc. All rights reserved.
//

#import "KCompany_DocumentTableViewCell.h"

@implementation KCompany_DocumentTableViewCell

- (instancetype )initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if(self)
    {
        [self p_setupView];
    }
    
    return self;
}

- (void )p_setupView
{
    self.image = [[UIImageView alloc] init];
    self.image.layer.masksToBounds = YES;
    self.image.image = [UIImage imageNamed:@"document.png"];
    [self.contentView addSubview:self.image];
    
    //
    self.name = [[UILabel alloc] init];
    self.name.text = @"文件名称";
    self.name.textColor = [UIColor blackColor];
    self.name.font = [UIFont systemFontOfSize:17.0f];
    [self.contentView addSubview:self.name];
    
    //
    self.date = [[UILabel alloc] init];
    self.date.text = @"2016-11-20 10:20";
    self.date.textColor = [UIColor grayColor];
    self.date.font = [UIFont systemFontOfSize:15.0f];
    [self.contentView addSubview:self.date];
    
    //
    self.capacity = [[UILabel alloc] init];
    self.capacity.text = @"2M";
    self.capacity.textAlignment = NSTextAlignmentRight;
    self.capacity.font = [UIFont systemFontOfSize:15.0f];
    self.capacity.textColor = [UIColor grayColor];
    self.capacity.hidden = YES;
    [self.contentView addSubview:self.capacity];
    
    //
    self.btn_select = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [self.btn_select setBackgroundImage:[UIImage imageNamed:@"Forwarding.png"] forState:(UIControlStateNormal)];
    self.btn_select.hidden = YES;
    [self.contentView addSubview:self.btn_select];
    
    //
    self.view_Line = [[UIView alloc] init];
    self.view_Line.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:self.view_Line];
}

- (void )layoutSubviews
{
    [super layoutSubviews];
    
    self.image.frame = CGRectMake(15, 15, 30, 30);
    
    self.name.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 15, 10, SCREEN_WIDTH - CGRectGetMaxX(self.image.frame) - 15 - 50, 20);
    
    self.date.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 15, CGRectGetMaxY(self.name.frame) + 5, 150, 15);
    
    self.capacity.frame = CGRectMake(SCREEN_WIDTH - 50 - 50 - 10, CGRectGetMaxY(self.name.frame) + 5, 50, 15);
    
    self.btn_select.frame = CGRectMake(SCREEN_WIDTH - 15 - 25, 17.5, 25, 25);
    
    self.view_Line.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 15, 59, SCREEN_WIDTH - CGRectGetMaxX(self.image.frame) - 15, 1);
}


@end
